/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.atencionemergencia.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "raza")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Raza.findAll", query = "SELECT r FROM Raza r"),
    @NamedQuery(name = "Raza.findByCodRaza", query = "SELECT r FROM Raza r WHERE r.codRaza = :codRaza"),
    @NamedQuery(name = "Raza.findByDescRaza", query = "SELECT r FROM Raza r WHERE r.descRaza = :descRaza")})
public class Raza implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Raza", columnDefinition="CHAR(5) unsigned")
    private String codRaza;
    @Column(name = "Desc_Raza")
    private String descRaza;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codRaza")
    private Collection<AnimalMordedor> animalMordedorCollection;

    public Raza() {
    }

    public Raza(String codRaza) {
        this.codRaza = codRaza;
    }

    public String getCodRaza() {
        return codRaza;
    }

    public void setCodRaza(String codRaza) {
        this.codRaza = codRaza;
    }

    public String getDescRaza() {
        return descRaza;
    }

    public void setDescRaza(String descRaza) {
        this.descRaza = descRaza;
    }

    @XmlTransient
    public Collection<AnimalMordedor> getAnimalMordedorCollection() {
        return animalMordedorCollection;
    }

    public void setAnimalMordedorCollection(Collection<AnimalMordedor> animalMordedorCollection) {
        this.animalMordedorCollection = animalMordedorCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codRaza != null ? codRaza.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Raza)) {
            return false;
        }
        Raza other = (Raza) object;
        if ((this.codRaza == null && other.codRaza != null) || (this.codRaza != null && !this.codRaza.equals(other.codRaza))) {
            return false;
        }
        return true;
    }
    
}
